package com.hw.springcloud.Controller;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Classname: ConfigController
 * @Description: 描述
 * @Date: 2021/12/10
 * @Author: HuWei
 */
@RestController
@RefreshScope // 动态刷新配置信息
@RequestMapping("/nacos")
public class ConfigController {

    // 注解内的cpnfig.info必须和nacos配置的yaml配置上的名称一样,否则会报错
    @Value("${config.info}")
    private String configInfo;

    @GetMapping("/getConfig")
    public String getConfig(){
        return configInfo;
    }
}
